package com.example.tree.bean;

import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableLogic;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.Version;
import java.io.Serializable;
import java.time.LocalDateTime;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;

import lombok.*;
import mybatis.mate.annotation.FieldSensitive;

/**
 * <p>
 * 
 * </p>
 *
 * @author ZhengDing
 * @since 2022-02-21 23:40:09
 */
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@TableName("user")
@ApiModel(value = "User对象", description = "")
public class User implements Serializable {

    private static final long serialVersionUID = 1L;

    @ApiModelProperty("ID")
    @TableId(value = "id", type = IdType.ASSIGN_UUID)
    private String id;

    @ApiModelProperty("帐号名")
    @TableField("username")
    private String username;

    @ApiModelProperty("帐号密码")
    @TableField("password")
    @FieldSensitive("testStrategy")
    private String password;

    @ApiModelProperty("年龄")
    @TableField("age")
    @FieldSensitive("testStrategy")
    private Integer age;
    
    @FieldSensitive("phone")
    private String phone;

    @ApiModelProperty("昵称")
    @TableField("nickname")
    private String nickname;

    @ApiModelProperty("简介")
    @TableField("description")
    private String description;

    @ApiModelProperty("邮箱")
    @TableField("email")
    @FieldSensitive("email")
    private String email;

    @ApiModelProperty("逻辑删除")
    @TableField("is_deleted")
    @TableLogic
    private Integer isDeleted;

    @ApiModelProperty("乐观锁")
    @TableField("version")
    @Version
    private Integer version;

    @ApiModelProperty("创建时间")
    @TableField(value = "create_time", fill = FieldFill.INSERT)
    private LocalDateTime createTime;

    @ApiModelProperty("更新时间")
    @TableField(value = "update_time", fill = FieldFill.INSERT_UPDATE)
    private LocalDateTime updateTime;


    public static final String ID = "id";

    public static final String USERNAME = "username";

    public static final String PASSWORD = "password";

    public static final String AGE = "age";

    public static final String NICKNAME = "nickname";

    public static final String DESCRIPTION = "description";

    public static final String EMAIL = "email";

    public static final String IS_DELETED = "is_deleted";

    public static final String VERSION = "version";

    public static final String CREATE_TIME = "create_time";

    public static final String UPDATE_TIME = "update_time";

}
